import BaseXform from '../base-xform';

class CustomFilterXform extends BaseXform {
    get tag() {
        return 'customFilter';
    }

    render(xmlStream, model) {
        xmlStream.leafNode(this.tag, {
            val: model.val,
            operator: model.operator,
        });
    }

    parseXmlObject(node) {
        if (node.name === this.tag) {
            this.model = {
                val: node._attributes.val,
                operator: node._attributes.operator,
            };
            return true;
        }
        return false;
    }

    parseOpen(node) {
        if (node.name === this.tag) {
            this.model = {
                val: node.attributes.val,
                operator: node.attributes.operator,
            };
            return true;
        }
        return false;
    }

    parseText() {
    }

    parseClose() {
        return false;
    }
}

export default CustomFilterXform;
